﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Derbster.Peer
{
    public class PeerContext
    {
        private readonly static List<string> _knownPeerIds = new List<string>();

        public static List<string> KnownPeerIds
        {
            get
            {
                return _knownPeerIds;
            }
        }

        private static string _peerId;

        public static string PeerId
        {
            get
            {
                return _peerId;
            }
            set
            {
                if (_peerId == null)
                {
                    _peerId = value;
                }
                else
                {
                    throw new InvalidOperationException("PeerId can be set only once.");
                }
            }
        }

        public static readonly VectorClock _currentVectorClock = new VectorClock();

        public static VectorClock CurrentVectorClock
        {
            get
            {
                return _currentVectorClock;
            }
        }
    }
}
